package com.gmlive.common.sample.views

import android.content.res.Resources

/**
 *
 * @Author Sven
 * @Date 2021/7/27
 * @Email jiangzhimin@inke.cn
 */
private fun Float.toPx(): Int {
    val scale = Resources.getSystem().displayMetrics.density
    return (this * scale + 0.5f).toInt()
}

val Float.ipx
    get() = toPx()

val Float.px
    get() = toPx().toFloat()

val Int.px
    get() = toFloat().toPx().toFloat()

val Int.ipx
    get() = toFloat().toPx()